package com.community.mapper.page;

import com.community.entity.Announcement;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface PageMapper {

    @Select("SELECT id, title, content, created_at, creator_name FROM announcement ORDER BY created_at DESC LIMIT 3")
    List<Announcement> findTop3Announcements();

    @Select("SELECT id, title, content, created_at, creator_name FROM announcement WHERE id = #{id}")
    Announcement findAnnouncementById(String id);
}